import { PureComponent } from 'react';
import moment from 'moment';
import {
    Row,
    Col,
    Form,
    Input,
    Select,
    Modal,
    Cascader,
    DatePicker
} from 'antd';
const FormItem = Form.Item;
const { Option } = Select;
import { dicTextByCodePcode,dicListByPcode } from '@/utils/dictionary'


@Form.create()
class CreateForm extends PureComponent {

	constructor(props) {
	    super(props);
	    this.state = {

	    }
	}


	okHandle = () => {
		const { form,handleAdd } = this.props;

	    form.validateFields((err, fieldsValue) => {
		        if (err) return;
		        form.resetFields();
			   	if(fieldsValue.a3307) {
			   				fieldsValue.a3307 = moment(fieldsValue.a3307._d).format("YYYY-MM-DD");
			   			}
			    handleAdd(fieldsValue,'FamilyMemberInfo');
		});
	};


	resetButton = () => {

	};

  render() {
    const {form: {getFieldDecorator}, modalVisibleByFamilyMemberInfo,handleModalVisible} = this.props;

return (
    <Modal
width={800}
destroyOnClose
title="添加家庭成员信息"
visible={modalVisibleByFamilyMemberInfo}
onOk={this.okHandle}
onCancel={() => handleModalVisible(false,"FamilyMemberInfo")}
afterClose={() => this.resetButton()}
>
<Form  layout="vertical">
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		    <Col md={12} sm={24}>
		      <FormItem  label="姓名">
		          {getFieldDecorator('a3301', {
		          rules: [{ required: false, message: '请输入1-10个字符',max: 10}],
		          })(<Input placeholder="1-10个字符"/>)}
		      </FormItem>
		    </Col>

		    <Col md={12} sm={24}>
		      <FormItem  label="与该人关系">
		          {getFieldDecorator('a3304', {
		            rules: [{ required: false, message: '请选择'}],
		          })(
		            <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		            	{dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		            		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		            	}):null}
		            </Select>
		          )}
		      </FormItem>
		    </Col>

		</Row>
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		    <Col md={12} sm={24}>
		      <FormItem  label="性别">
		          {getFieldDecorator('a3345',{
		          })(
		          	<Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		          		{dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		          			return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		          		}):null}
		          	</Select>
		          )}
		      </FormItem>
		    </Col>
		    <Col md={12} sm={24}>
		      <FormItem  label="出生日期">
		          {getFieldDecorator('a3307', {
		          rules: [{ required: false, message: '请选择'}],
		          })(<DatePicker  format="YYYY-MM-DD" style={{ width: '100%' }} placeholder="请选择"/>)}
		      </FormItem>
		    </Col>

		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		<Col md={12} sm={24}>
		      <FormItem  label="政治面貌">
		          {getFieldDecorator('a3327', {
		          rules: [{ required: false, message: '请选择'}],
		          })(
		          	<Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		          	  	{dicListByPcode('YT') != undefined?dicListByPcode('YT').map((item,index) => {
		          	  		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		          	  	}):null}
		          	  </Select>
		          )}
		      </FormItem>
		    </Col>

		    <Col md={12} sm={24}>
		      <FormItem  label="现状">
		          {getFieldDecorator('a3341',{
		            rules: [{ required: false, message: '请选择！'}],
		          })(
		          	<Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		              {dicListByPcode('R1') != undefined?dicListByPcode('R1').map((item,index) => {
		                return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		              }):null}
		            </Select>
		          )}
		      </FormItem>
		    </Col>

		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>


		    <Col md={12} sm={24}>
		      <FormItem  label="工作单位名称">
		          {getFieldDecorator('a3311', {
		          rules: [{ required: false, message: '1-40个字符'}],
		          })(
		            <Input placeholder="1-40个字符" />
		          )}
		      </FormItem>
		    </Col>
		    <Col md={12} sm={24}>
		      <FormItem  label="工作单位所在政区">
		          {getFieldDecorator('a3314', {
		          rules: [{ required: false, message: '1-40个字符'}],
		          })(
              <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
                {dicListByPcode('R1') != undefined?dicListByPcode('R1').map((item,index) => {
                  return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
                }):null}
              </Select>
              )}
		       </FormItem>
		    </Col>

		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>


		    <Col md={12} sm={24}>
		      <FormItem  label="国籍">
		          {getFieldDecorator('a3317', {
		          rules: [{ required: false, message: '请选择' }],
		          })(
              <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
                {dicListByPcode('R1') != undefined?dicListByPcode('R1').map((item,index) => {
                  return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
                }):null}
              </Select>
              )}
		          </FormItem>
		    </Col>

		   	<Col  md={12} sm={24}>
		   	  <FormItem  label="民族">
		   	      {getFieldDecorator('a3321', {
		   	        rules: [{ required: false, message: '请选择'}],
		   	        })(
                <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
                  {dicListByPcode('R1') != undefined?dicListByPcode('R1').map((item,index) => {
                    return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
                  }):null}
                </Select>
                )}
		   	  </FormItem>
		   	</Col>

		</Row>
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
			  <FormItem  label="学历">
			      {getFieldDecorator('a3324', {
			        rules: [{ required: false, message: '请选择'}],
			        })(
			        <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
			        	{dicListByPcode('BG') != undefined?dicListByPcode('BG').map((item,index) => {
			        		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
			        	}):null}
			        </Select>
			      )}
			  </FormItem>
			</Col>

		  <Col md={12} sm={24}>
		    <FormItem  label="身份">
		        {getFieldDecorator('a3331', {
		          rules: [{ required: false, message: '请选择'}],
		          })(
		          <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		          	{dicListByPcode('JK') != undefined?dicListByPcode('JK').map((item,index) => {
		          		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		          	}):null}
		          </Select>
		        )}
		    </FormItem>
		  </Col>
		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
			  <FormItem  label="工作职务">
			      {getFieldDecorator('a3312', {
			        rules: [{ required: false, message: '1-40个字符'}],
			        })(
			        <Input placeholder="1-40个字符" />
			      )}
			  </FormItem>
			</Col>

		  <Col md={12} sm={24}>
		    <FormItem  label="职务层次">
		        {getFieldDecorator('a3337', {
		          rules: [{ required: false, message: '1-40个字符'}],
		          })(
		          <Input placeholder="1-40个字符" />
		        )}
		    </FormItem>
		  </Col>
		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
			  <FormItem  label="联系方式">
			      {getFieldDecorator('a3347', {
			        rules: [{ required: false, message: '1-40个字符'}],
			        })(
			        <Input placeholder="1-40个字符" />
			      )}
			  </FormItem>
			</Col>

		  <Col md={12} sm={24}>
		    <FormItem  label="住址">
		        {getFieldDecorator('a3346', {
		          rules: [{ required: false, message: '1-40个字符'}],
		          })(
		          <Input placeholder="1-40个字符" />
		        )}
		    </FormItem>
		  </Col>
		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
			  <FormItem  label="备注">
			      {getFieldDecorator('a3344', {
			        rules: [{ required: false, message: '1-40个字符'}],
			        })(
			        <Input placeholder="1-40个字符" />
			      )}
			  </FormItem>
			</Col>

		</Row>

</Form>
</Modal>
);
  }

}

export default CreateForm;
